package com.koron.css2.baseConfig.impl;

import com.koron.css2.ServerInterface;
import com.koron.css2.baseConfig.bean.ProjectPayeeBean;
import com.koron.css2.baseConfig.mapper.ProjectPayeeMapper;
import com.koron.css2.serviceManage.bean.RequestBean;
import com.koron.css2.serviceManage.bean.UserInfoBean;
import com.koron.css2.serviceManage.utils.JsonUtils;
import com.koron.util.Constant;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.koron.ebs.mybatis.SessionFactory;
import org.swan.bean.MessageBean;

/**
 * 工程收款主体 删除
 * @author 10950
 *
 */
public class ProjectPayeeDelete implements ServerInterface{
	private static Logger log = LogManager.getLogger(ProjectPayeeSave.class);
	@Override
	public MessageBean<?> exec(SessionFactory factory, UserInfoBean userInfo, RequestBean req) {
		try {
			ProjectPayeeBean bean = JsonUtils.objectToPojo(req.getData(), ProjectPayeeBean.class);
			ProjectPayeeMapper mapper = factory.getMapper(ProjectPayeeMapper.class);
			mapper.delete(bean);
			return MessageBean.create(Constant.MESSAGE_INT_SUCCESS, "success", void.class);
		}catch(Exception e) {
			log.error("删除失败",e);
			return MessageBean.create(Constant.MESSAGE_INT_FAIL, "删除失败", void.class);
		}
	}

}
